import request from '@/utils/request'
import useSetStore from '@/store/modules/set'

// 查询环境
export function env() {
  return request({
    url: '/app_api/system/config/env',
    method: 'get'
  })
}

// 上传图片
export function upload(tempFilePath) {
	return new Promise((resolve, reject) => {
		const setStore = useSetStore()
		uni.uploadFile({
		  url: setStore.baseUrl + '/app_api/common/upload',
		  filePath: tempFilePath,
		  name: 'file',
		  success(res) {
			  resolve(res)
		  },
		  fail(err) {
			  reject(err)
		  }
		})
	})
}

// 版本更新
export function checkUpdateApi(query) {
  return request({
    url: '/app_api/app/version/check-update',
    method: 'get',
		params: query
  })
}